#include <rclcpp/rclcpp.hpp>
#include <geometry_msgs/msg/twist.hpp>

class VelNode : public rclcpp::Node{

public:
    VelNode() : Node("vel_node"){
        pub = this->create_publisher<geometry_msgs::msg::Twist>("/cmd_vel", 10);
        timer = create_wall_timer(std::chrono::milliseconds(100), std::bind(&VelNode::publisherMsg, this));
    }
    private:
        void publisherMsg();
        rclcpp::Publisher<geometry_msgs::msg::Twist>::SharedPtr pub;
        rclcpp::TimerBase::SharedPtr timer;
};

void VelNode::publisherMsg(){
    geometry_msgs::msg::Twist msg;

    msg.linear.x = 0.5;
    msg.linear.y = 0.0;
    msg.linear.z = 0.0;

    msg.angular.x = 0.0;
    msg.angular.y = 0.0;
    msg.angular.z = 0.0;

    pub->publish(msg);
}
int main(int argc, char **argv)
{
    rclcpp::init(argc, argv);

    auto node = std::make_shared<VelNode>();

    rclcpp::spin(node);

    rclcpp::shutdown();
    return 0;
}